package org.xiancheng;

public class tongbusuo extends Thread{
	static int num = 100;
	@Override
	public void run() {
		//System.out.println(this.getClass());
		while(true){
			synchronized(this.getClass()){//同步锁
				if(num>0){
					System.out.println(Thread.currentThread().getName()+":"+num);
					num--;
				}else{
					break;
				}
			}
			
		}
	}

}
